<extend name="template/base_index" />

<block name="area_header">

	<link rel="stylesheet" href="__CSS__/buysell.css">
</block>

<block name="area_body">
	<div class="contain-box">
		<div class="head">
			<a href="{:U('Mybuysell/mybuy')}"><i class="fa fa-chevron-left"></i></a>
			<span>订单信息</span>
		</div>
		<div class="progress">
			<if condition="$pay_status == 0"><!--待付款-->
				<img src="__IMG__/100.png">
			</if>
			<if condition="$order_status == 3"><!--待发货-->
				<img src="__IMG__/101.png">
			</if>
			<if condition="$order_status == 4"><!--已发货-->
				<img src="__IMG__/102.png">
			</if>
			<if condition="$order_status == 5"><!--交易成功-->
				<img src="__IMG__/103.png">
			</if>
			<if condition="$order_status == 12"><!--交易关闭-->
				<img src="__IMG__/104.png">
			</if>
		</div>
		<div class="adress">
			<ul>
				<li>收货人：{$express['contactname']}</li>
				<li>地址：{$express['province']}省{$express['city']}{$express['area']}{$express['detailinfo']}</li>
				<li>联系电话：{$express['mobile']}</li>
			</ul>
			<if condition="($order_code eq 4) OR ($order_code eq 5)">
				<div class="express">
					<ul>
						<li><span>物流信息</span></li>
						<li><img src="images/货车.png"><p>{$express['expressname']}：{$express['expressno']}</p></li>
					</ul>
				</div>
			</if>
		</div>
		<div class="product">
			<img src="{$iteminfo['img']}">
			<table>
				<tr>
					<td colspan="2" class="property">{$iteminfo['name']}</td>
				</tr>
				<tr>
					<td class="property">售出价格</td>
					<td class="right">&yen;{$iteminfo['price']}</td>
				</tr>
				<tr>
					<td class="property">运费</td>
					<td class="right">&yen;{$iteminfo['post_price']}</td>
				</tr>
				<tr>
					<td class="property"><span id="sum">合计</span></td>
					<td class="right" id="sumyen">&yen;{$iteminfo['sumprice']}</td>
				</tr>
			</table>
			<div class="clear"></div>
		</div>
		<div class="sellinfo">
			<table>
				<tr>
					<td>卖家昵称</td>
					<td>{$nickname}</td>
				</tr>
				<tr>
					<td>订单编号</td>
					<td>{$iteminfo['order_code']}</td>
				</tr>
				<tr>
					<td>成交时间</td>
					<td>{$iteminfo['createtime']|date="Y-m-d H:i:s",###}</td>
				</tr>
			</table>
		</div>
	</div>
	<if condition="$pay_status == 0"><!--待付款-->
		<div class="footer">
			<center class="pay_a"><a href="http://muyin.itboye.com/index.php/Home/Pay/jsapi/?order_code={$iteminfo['order_code']}">我要付款</a></center>
		</div>
	</if>
	<if condition="$order_status == 3">
		<div class="footer">
			<center >
				<a data-href="{:U('Mybuysell/apply_returnmoney',array('order_code' => $iteminfo['order_code']))}" href="javascript:;"  class="show-confirm weui_btn weui_btn_mini weui_btn_default">取消订单申请退款</a>
			</center>
		</div>
	</if>
	<if condition="$order_status == 4"><!--已发货-->
		<div class="footer">
			<center>
				<a href="http://m.kuaidi100.com/index_all.html?type={$express['expresscode']}&postid={$express['expressno']}" class="weui_btn weui_btn_mini weui_btn_default">查看物流</a>
				<a data-href="{:U('Mybuysell/confirm_receipt',array('order_code' => $iteminfo['order_code']))}" class="confirm-receipt weui_btn weui_btn_mini weui_btn_default">确认收货</a>
			</center>
		</div>
	</if>
	<script src="__JS__/jquery-weui.min.js"></script>
	<script>
		$(function(){
			/*确认收货*/
			$(".confirm-receipt").bind("click", function() {
				var url = $(this).attr('data-href');
				$.confirm("您确定您已经收到货了", function() {
					$.get(url,function(msg){
						if(msg){
							$.toast("确认成功");
							window.location.reload();
						}else{
							$.toast("不好意思 确认失败了");
						}
					});

				}, function() {
					//取消操作
				});
			});

			$(".show-confirm").bind("click", function() {
				var url = $(this).attr('data-href');
				$.confirm("您确定要取消订单", function() {
					$.get(url,function(msg){
						if(msg){
							$.toast("信息发送成功");
							window.location.reload();
						}else{
							$.toast("信息发送失败");
						}
					});

				}, function() {
					//取消操作
				});
			});
		});



	</script>
</block>